< previous page page_659 next page >

Page 659
EXERCISE
Save Your Work!
1. Create a new folder and save all your changes into this folder.
2. Copy all the *.ICO files in the examples folder for this chapter to this new folder you created.
analysis.gifIt is a good idea to save all your work periodically. Be sure to keep the .ICO files in the same directory where your project is located.

The DragOver() Event
Before you actually start coding the DragOver() event, you need to learn a little about it. First, this event is fired whenever a control is dragged over another control. The DragOver() event is passed through four parameters: the control, the X and Y coordinates, and the state of the operation. The State argument can be one of three possible values, as listed in Table 32.1.
Table 32.1 Values of the State Argument in the DragOver() Event.
ValueDescriptionVisual Basic Constant
0The control being dragged is entering this object for the first time.vbEnter
1The control being dragged is leaving the object.vbLeave
2The control being dragged is still over the object.vbOver

Each time the control is moved over the form or any other control on the form, the DragOver() event is fired. For when the State argument is vbEnter or vbOver, you can write some code to change the DragIcon property of the control to the no drop icon. When the State argument becomes vbLeave, you need to set the DragIcon back to the original value. Youll use the LoadPicture() function to load the Trffc14.ico file for the no drop icon. The LoadPicture() function allows you to load any graphic file off of a disk and place that graphic into one of the picture type properties of any form or control. This is one of the files you just copied into your new folder. Youll use the Bullseye.ico file for the normal drag icon.

 
< previous page page_659 next page >

If you like this book, buy it!